<template>
  <div>{{text}}</div>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      flow_code:'flow_0001',
      data_id:'test_data_id_01',
      user_id:'1',

      nodeins_id:'5b2071de-9b62-4a2b-b031-d86f42fbcad5',

      text:'----',
    }
  },
  created() {
  },
  mounted(){
    this.v_getData();
  },
  methods: {
    async v_getData() {
      console.log('');
      console.log('Test>>------------------------------------------------------');

      this.test_initFlow();
      //this.test_completeNode();

      //this.test_showFlowinsInCanvas();

      //this.test_pushBack();
      //this.test_setNodeinsUser();

      //this.test_getFlowinsParam();
      //this.test_getUserTaskRunning();
      //this.GetUserTaskCompleted();

    },
    async test_initFlow() {
      let pData = {'flow_code':this.flow_code,'user_id':this.user_id,'data_id':this.data_id};
      pData['token'] = elm.info.token;//传入当前用户登录时生成的token
      pData['no_auto_next'] = '1';//测试用，阻止连续自动完成
      //let data = await elm.post('http://localhost:3000/api/system/login/flow/InitFlow', pData);
      let data = await elm.post('/system/login/flow/InitFlow', pData);
      this.text = JSON.stringify(data);//console.log(this.text);
    },
    async test_completeNode() {
      let pData = {'nodeins_id':this.nodeins_id,'user_id':this.user_id};
      pData['token'] = elm.info.token;
      pData['s_num'] = '100';
      pData['no_auto_next'] = '1';//测试用，阻止连续自动完成
      let data = await elm.post('/system/login/flow/CompleteNodeins', pData);
      this.text = JSON.stringify(data);//console.log(this.text);
    },
    test_showFlowinsInCanvas:function(){
      let pData = {
        'show_flowins':'yes',
        'flow_code':this.flow_code,
        'data_id':this.data_id,
      };
      elm.dialog.open(this, '/system/flow/flow_canvas', '流程信息', 1000, 600, pData, true);
    },
    async test_pushBack() {
      let pData = {'nodeins_id':this.nodeins_id,'user_id':this.user_id,'pb_text':'退回意见11'};
      pData['token'] = elm.info.token;
      let data = await elm.post('/system/login/flow/PushBackToNodeins', pData);
      this.text = JSON.stringify(data);//console.log(this.text);
    },
    async test_setNodeinsUser() {
      let pData = {'nodeins_id':this.nodeins_id,'node_user_list':[{'user_type':'user','user_id':this.user_id}]};
      pData['token'] = elm.info.token;
      let data = await elm.post('/system/login/flow/SetNodeinsUser', pData);
      this.text = JSON.stringify(data);//console.log(this.text);
    },
    async test_getFlowinsParam() {
      let pData = {'flow_code':this.flow_code,'data_id':this.data_id};
      let data = await elm.post('/system/login/flow/GetFlowinsParam', pData);
      this.text = JSON.stringify(data);//console.log(this.text);
    },
    async test_getUserTaskRunning() {
      let pData = {'pageNum':0,'pageSize':5};
      //pData['user_id'] = this.user_id;
      let data = await elm.post('/system/login/flow/GetUserTaskRunning', pData);
      this.text = JSON.stringify(data);//console.log(this.text);
    },
    async GetUserTaskCompleted() {
      let pData = {'pageNum':1,'pageSize':5};
      //pData['user_id'] = this.user_id;
      let data = await elm.post('/system/login/flow/GetUserTaskCompleted', pData);
      this.text = JSON.stringify(data);//console.log(this.text);
    },
  }
}
</script>

<style scoped>
</style>